home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 5981 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.0 KB  |  54 lines

  1. Path: magicnet.magicnet.net!gamecox
  2. From: gamecox@magicnet.magicnet.net (Jody Hagins)
  3. Newsgroups: comp.lang.c++
  4. Subject: Pure Virtual Destructor Question
  5. Date: 7 Feb 1996 18:49:14 GMT
  6. Organization: MagicNet, Inc.
  7. Message-ID: <4fas7a$7ns@comet2.magicnet.net>
  8. NNTP-Posting-Host: ns.magicnet.net
  9. X-Newsreader: TIN [version 1.2 PL2]
  10.  
  11. Assume a class Foo s.t.
  12.  
  13. class Foo
  14. {
  15. public:
  16.   virtual ~Foo() = 0;
  17. };
  18.  
  19. inline Foo::~Foo()
  20. {
  21.   // do some destructor stuff
  22. }
  23.  
  24.  
  25. This is correct, and compiles fine.  However, I get a warning:
  26. "foo.h", : warning: please provide an out-of-line definition:  Foo::~Foo() {}; 
  27. hich is needed by derived classes
  28.  
  29. Even when I make it non inline (in foo.C) I still get it.  The only way
  30. I can think of to get around the problem is to do it right in the declaration
  31. itself.  However, the compiler barks at both
  32.  
  33. class Foo
  34. {
  35. public:
  36.   virtual ~Foo() { /* do some stuff */ } = 0;
  37. };
  38.  
  39. and
  40.  
  41. class Foo
  42. {
  43. public:
  44.   virtual ~Foo() = 0 { /* do some stuff */ }
  45. };
  46.  
  47.  
  48. Any hints???
  49.  
  50. Thanks,
  51.     -Jody
  52.     gamecox@magicnet.net
  53.  
  54.